#include "../skyAdapter.h"

#ifdef _SYMBIAN



#include "../skyPict.h"
#include "../skyCanvas.h"


namespace Sky
{
	TBool Canvas::create(TInt w,TInt h,TInt format,TUint subFormat)
	{
		::TSize size(w,h);
		xAssert(_pict == vNull);
		
		_pict = new Pict();
		xAssert(_pict);
		if(_pict == vNull)return vFalse;
		
		_pict->_bitmap = new CFbsBitmap;
		xAssert(_pict->_bitmap);
		if(_pict->_bitmap == vNull)return vFalse;
		
		TUint tFormat = format;
		switch(format)
		{
		case Format_Default:
			tFormat =	EColor16M;
			break;
		defualt:
			tFormat = format;
			break;
		}
		_pict->_bitmap->Create(size, (TDisplayMode)tFormat); 
		mType = Type_Create;
		if(subFormat != 0)
		{
			_pict->_bitmapMask = new CFbsBitmap;
			xAssert(_pict->_bitmapMask);
			if(_pict->_bitmapMask == vNull)
			{
				mType = Type_CreateWitMask;
				SAFE_DELETE(_pict->_bitmap);
				SAFE_DELETE(_pict);
				return vFalse;
			}
			_pict->_bitmapMask->Create(size,(TDisplayMode)subFormat);
		}
		return vTrue;
	}
	TVoid  Canvas::Delete()
	{
			
			SAFE_DELETE(_pict);
	};
}
#endif
